switch: Fix text positioning
authorTimm Bäder <mail@baedert.org>
Tue, 12 Jan 2016 20:37:27 +0000 (21:37 +0100)
committerTimm Bäder <mail@baedert.org>
Tue, 12 Jan 2016 20:56:53 +0000 (21:56 +0100)
https://bugzilla.gnome.org/show_bug.cgi?id=760509

gtk/gtkswitch.c

index 9f6f6596ba8fb3b7660276cd84e725fed4180757..249753b457619996ba9cb649ccde05410f25d53f 100644 (file)
@@ -624,8 +624,8 @@ gtk_switch_render_trough (GtkCssGadget *gadget,
 
   pango_layout_get_pixel_extents (layout, NULL, &rect);
 
-  label_x = ((width / 2) - rect.width) / 2;
-  label_y = (height - rect.height) / 2;
+  label_x = x + ((width / 2) - rect.width) / 2;
+  label_y = y + (height - rect.height) / 2;
 
   gtk_render_layout (context, cr, label_x, label_y, layout);
 
@@ -638,8 +638,8 @@ gtk_switch_render_trough (GtkCssGadget *gadget,
 
   pango_layout_get_pixel_extents (layout, NULL, &rect);
 
-  label_x = (width / 2) + ((width / 2) - rect.width) / 2;
-  label_y = (height - rect.height) / 2;
+  label_x = x + (width / 2) + ((width / 2) - rect.width) / 2;
+  label_y = y + (height - rect.height) / 2;
 
   gtk_render_layout (context, cr, label_x, label_y, layout);